package com.java.zhuiyun.api.home.controller;

import com.java.zhuiyun.api.home.service.HomeService;
import com.java.zhuiyun.common.response.CommonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName HomeController
 * @Description TODO
 * @Author wuwan
 * @Date 2023/8/14 20:06
 **/
@Slf4j
@RestController
@CrossOrigin
@RequestMapping("/Home")
public class HomeController {
    @Autowired
    private HomeService homeService;

    /*
     * @Author wuwan
     * @Description 地区人数分布统计
     * @Date 2023/8/20 19:10
     * @Return
     * @param null
     */
    @GetMapping("/statisticsOne")
    public CommonResult statisticsOne(){
        CommonResult commonResult = homeService.statisticsOne();
        return CommonResult.ok(commonResult);
    }
    /*
     * @Author wuwan
     * @Description 月销量统计
     * @Date 2023/8/20 19:10
     * @Return
     * @param null
     */
    @GetMapping("/salesVolume")
    public CommonResult salesVolume(String selectedYear) {
        CommonResult salesVolume = homeService.salesVolume(selectedYear);
        return CommonResult.ok(salesVolume);
    }
    /*
     * @Author wuwan
     * @Description 月销量统计
     * @Date 2023/8/20 19:10
     * @Return
     * @param null
     */
    @GetMapping("/salesVolumeYear")
    public CommonResult salesVolumesYear() {
        CommonResult salesVolumesYear = homeService.salesVolumesYear();
        return CommonResult.ok(salesVolumesYear);
    }
    /*
     * @Author wuwan
     * @Description 年盈利额度
     * @Date 2023/8/20 19:10
     * @Return
     * @param null
     */
    @GetMapping("/getgetqq")
    public CommonResult getgetqq() {
        CommonResult profitYear = homeService.getgetqq();
        return CommonResult.ok(profitYear);
    }
    /*
    * @Author wuwan
    * @Description 课程点击量排名
    * @Date 2023/9/6 21:12
    * @Return
    * @param null
    */
    @GetMapping("/courseRanking")
    public CommonResult courseRanking(){
        return CommonResult.ok(homeService.courseRanking());
    }
}
